package com.think.service.exp;

import com.think.service.model.ResultModel;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class ResponseEntityFactory {

    public static ResponseEntity<ResultModel> success(ResultModel resultModel) {
        return new ResponseEntity(resultModel, HttpStatus.OK);
    }

    public static ResponseEntity<ResultModel> success(ResultModel resultModel, int statusCode) {
        return new ResponseEntity(resultModel, HttpStatus.valueOf(statusCode));
    }

    public static ResponseEntity<ResultModel> fail500(ResultModel resultModel) {
        return new ResponseEntity(resultModel, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    public static ResponseEntity<ResultModel> fail(ResultModel resultModel, int statusCode) {
        return new ResponseEntity(resultModel, HttpStatus.valueOf(statusCode));
    }
}
